Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cgpt-voting-power] Adding cgpt-voting-power strategy #1151

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ghost
Copy link

@ghost ghost commented May 5, 2023

Fixes # .

Changes proposed in this pull request:

  • Add cgpt-voting-power strategy

@ChaituVR ChaituVR changed the title Adding cgpt-voting-power strategy [cgpt-voting-power] Adding cgpt-voting-power strategy May 5, 2023
Comment on lines +26 to +38
const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';

const multi = new Multicaller(network, provider, abi, { blockTag });
addresses.forEach((address) =>
multi.call(address, options.address, 'getVotingPower', [address])
);
const result: Record<string, BigNumberish> = await multi.execute();

return Object.fromEntries(
Object.entries(result).map(([address, votingPower]) => [
address,
parseFloat(formatUnits(votingPower, options.decimals))
])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @chaingptuser You can use the contract-call strategy for this, no need to create a separate strategy, can try it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant